<!-- TinyMCE -->
<script type="text/javascript" src="<?php echo base_url();?>js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	// Default skin
	tinyMCE.init({
		file_browser_callback : 'myFileBrowser', // <----PERHATIKAN INI !
		// General options
		mode : "exact",

		elements : "elm1, elm2",
		theme : "advanced",
		plugins : "autolink,lists,pagebreak,style,layer,table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,inlinepopups,autosave",

		// Theme options
		theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,|,image,|,code",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,|,sub,sup",
		theme_advanced_buttons4 : "insertdate,inserttime,preview,|,forecolor,backcolor,|,charmap,emotions,iespell,advhr,|,ltr,rtl,|,fullscreen",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});


</script>
<script type='text/javascript'/>
function myFileBrowser (field_name, url, type, win) {
 //url='upload.php';
 //alert("Field_Name: " + field_name + "\nURL: " + url + "\nType: " + type + "\nWin: " + win); // debug/testing
 /* If you work with sessions in PHP and your client doesn't accept cookies you might need to carry
 the session name and session ID in the request string (can look like this: "?PHPSESSID=88p0n70s9dsknra96qhuk6etm5").
 These lines of code extract the necessary parameters and add them back to the filebrowser URL again. */
 var cmsURL = '<?php echo base_url();?>/tinymce_system/tinymce_upload' // <-------- PERHATIKAN INI !
 if (cmsURL.indexOf("?") < 0) {
 //add the type as the only query parameter
 cmsURL = cmsURL + "?type=" + type;
 }
 else {
 //add the type as an additional query parameter
 // (PHP session ID is now included if there is one at all)
 cmsURL = cmsURL + "&type=" + type;
 }
 tinyMCE.activeEditor.windowManager.open({
 file : cmsURL,
 title : 'My File Browser',
 width : 420, // Your dimensions may differ - toy around with them!
 height : 400,
 resizable : "yes",
 inline : "yes", // This parameter only has an effect if you use the inlinepopups plugin!
 close_previous : "no"
 }, {
 window : win,
 input : field_name
 });
 return false;
 }
</script>

<!-- /TinyMCE -->
